import moment from 'moment'

// 得到一个小时集合
export const handleHourSet = (count) => {
  const data = []
  let character = 0
  while (count >= 1) {
    data.push(character)
    character++
    count--
    if (character === 24) character = 0
  }
  return data.map(item=>item < 10 ? `0${item}:00` : `${item}:00`)
}

// 得到一个天数集合
export const handleDaySet = (start, end) => {
  const dataList = []
  let startTime = moment(start).startOf('day')
  const endTime = moment(end).startOf('day')
  while (startTime.isSameOrBefore(endTime, 'day')) {
    dataList.push(startTime.format('YYYY-M-D'))
    startTime = startTime.add(1, 'day')
  }
  return dataList
}
